package com.weng.coder.common;


import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;




/**
 * 系统基础配置类
 * @author wengzhonghui
 *
 */
@Component
@Slf4j
public class CommonProperties {

	/** 国际化配置，1：中文，2：英文 */
	public static final String localeLanguage_zhcn = "zhCN";
	public static final String localeLanguage_enus = "enUS";
	public static String localeLanguage = localeLanguage_zhcn;
	@Value("${i18n.locale}")
	public void setI18n(String i18nLocale) {
		localeLanguage = ("2".equals(i18nLocale)||"en_US".equals(i18nLocale)) 
			? localeLanguage_enus : localeLanguage_zhcn;
		log.info("Locale language set [" + localeLanguage + "]");
	}
	
	/*导出文件*/
	public static String downloadExcelPath = "";
	@Value("${download.excel.path}")
	public void setTaskFileViewPath(String downloadExcelPath) {
		CommonProperties.downloadExcelPath = downloadExcelPath;
	}
	
	/*生成excel文件路径*/
	public static String generateExcelPath = "";
	@Value("${generate.excel.path}")
	public void setdownloadExcelPath(String downloadExcelPath) {
		CommonProperties.generateExcelPath = downloadExcelPath;
	}
	
	/*最大支持导出数据条数设置*/
	public static int maxAllowExportNum = 1000;
	@Value("${max.allow.export.num}")
	public void setMaxAllowExportNum(Integer maxAllowExportNum) {
		CommonProperties.maxAllowExportNum = maxAllowExportNum;
	}
	
	/*上传或生成web下载的文件地址*/
	public static String webUploadPath = "";
	@Value("${web.upload-path}")
	public void setWebUploadPath(String webUploadPath) {
		CommonProperties.webUploadPath = webUploadPath;
	}
}
